GIcon *icon;
ClutterActor *ret;
+ ret = NULL;
+
if (info->type == SHELL_APP_INFO_TYPE_WINDOW)
{
- return st_texture_cache_bind_pixbuf_property (st_texture_cache_get_default (),
- G_OBJECT (info->window),
- "icon");
+ ret = st_texture_cache_bind_pixbuf_property (st_texture_cache_get_default (),
+ G_OBJECT (info->window),
+ "icon");
}
-
- icon = shell_app_info_get_icon (info);
- if (icon == NULL)
+ else
{
- ret = clutter_texture_new ();
- g_object_set (ret, "opacity", 0, "width", size, "height", size, NULL);
+ icon = shell_app_info_get_icon (info);
+ if (icon != NULL)
+ {
+ ret = st_texture_cache_load_gicon (st_texture_cache_get_default (), NULL, icon, (int)size);
+ g_object_unref (icon);
+ }
}
- else
+
+ if (ret == NULL)
{
+ icon = g_themed_icon_new ("application-x-executable");
ret = st_texture_cache_load_gicon (st_texture_cache_get_default (), NULL, icon, (int)size);
g_object_unref (icon);
}
app = data->app;
size = data->size;
+ info = NULL;
+
icon = shell_app_info_get_icon (app->info);
- if (icon == NULL)
- return COGL_INVALID_HANDLE;
+ if (icon != NULL)
+ {
+ info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (),
+ icon, (int) (size + 0.5),
+ GTK_ICON_LOOKUP_FORCE_SIZE);
+ g_object_unref (icon);
+ }
+
+ if (info == NULL)
+ {
+ icon = g_themed_icon_new ("application-x-executable");
+ info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (),
+ icon, (int) (size + 0.5),
+ GTK_ICON_LOOKUP_FORCE_SIZE);
+ g_object_unref (icon);
+ }
- info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (),
- icon, (int) (size + 0.5),
- GTK_ICON_LOOKUP_FORCE_SIZE);
- g_object_unref (icon);
if (info == NULL)
return COGL_INVALID_HANDLE;
g_slist_free (request->textures);
g_free (request);
g_hash_table_remove (cache->priv->outstanding_requests, key);
+ g_object_unref (texture);
+ texture = NULL;
}
g_free (key);
* This will load @icon as a full-color icon; if you want a symbolic
* icon, you must use st_texture_cache_load_icon_name().
*
- * Return Value: (transfer none): A new #ClutterActor for the icon
+ * Return Value: (transfer none): A new #ClutterActor for the icon, or %NULL if not found
*/
ClutterActor *
st_texture_cache_load_gicon (StTextureCache *cache,
switch (icon_type)
{
case ST_ICON_APPLICATION:
+ themed = g_themed_icon_new (name);
+ texture = load_gicon_with_colors (cache, themed, size, NULL);
+ g_object_unref (themed);
+ if (texture == NULL)
+ {
+ themed = g_themed_icon_new ("application-x-executable");
+ texture = load_gicon_with_colors (cache, themed, size, NULL);
+ g_object_unref (themed);
+ }
+ return CLUTTER_ACTOR (texture);
+ break;
case ST_ICON_DOCUMENT:
themed = g_themed_icon_new (name);
texture = load_gicon_with_colors (cache, themed, size, NULL);
g_object_unref (themed);
+ if (texture == NULL)
+ {
+ themed = g_themed_icon_new ("x-office-document");
+ texture = load_gicon_with_colors (cache, themed, size, NULL);
+ g_object_unref (themed);
+ }
return CLUTTER_ACTOR (texture);
break;
themed = g_themed_icon_new_with_default_fallbacks (name);
texture = load_gicon_with_colors (cache, themed, size, NULL);
g_object_unref (themed);
+ if (texture == NULL)
+ {
+ themed = g_themed_icon_new ("image-missing");
+ texture = load_gicon_with_colors (cache, themed, size, NULL);
+ g_object_unref (themed);
+ }
return CLUTTER_ACTOR (texture);
break;